package com.cloud.demo2020.controller;

import com.cloud.demo2020.common.ResultBean;
import com.cloud.demo2020.service.EmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class EmailController {

    @Autowired
    private EmailService emailService;

    @RequestMapping("/email/{email}/{code}")
    public ResultBean send(@PathVariable("email") String email,
           @PathVariable String code) {
        this.emailService.send(email, code);
        return new ResultBean(true);
    }
}
